package org.example.springboot.entity;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.example.springboot.common.entity.BaseEntity;

import java.util.Date;

/**
 * 控制记录
 *
 * @author Fz
 * @since 1.0.0 2024-11-15
 */

@EqualsAndHashCode(callSuper = true)
@Data
@TableName("FMC_control")
public class FmcControl extends BaseEntity {

    @Column(name = "pid", comment = "项目编码", type = MySqlTypeConstant.VARCHAR)
    private String pid;

    @Column(name = "did", comment = "设备编码", type = MySqlTypeConstant.VARCHAR)
    private String did;

    @Column(name = "unit_code", comment = "灌溉单元编号", type = MySqlTypeConstant.VARCHAR)
    private String unitCode;

    @Column(name = "type", comment = "灌溉方式 0 定量灌溉 1 周期灌溉 2 水分控制灌溉  3 ET决策灌溉")
    private String type;

    @Column(name = "user_id", comment = "操作用户id", type = MySqlTypeConstant.VARCHAR)
    private String userId;

    @Column(name = "valt", comment = "电磁阀状态 1:开启 0:关闭", type = MySqlTypeConstant.INT)
    private Integer valt;

    @Column(name = "operation_time", comment = "操作时间", type = MySqlTypeConstant.DATETIME)
    private Date operationTime;

    @Column(name = "status", comment = "控制命令发送状态 成功：SUCCESS  失败：FAIL", type = MySqlTypeConstant.VARCHAR, defaultValue = "SUCCESS")
    private String status;

    @Column(name = "ex_msg", comment = "异常信息", type = MySqlTypeConstant.TEXT)
    private String exMsg;

    @Column(name = "topic", comment = "订阅主题", type = MySqlTypeConstant.VARCHAR)
    private String topic;

    @Column(name = "sort", comment = "排序", type = MySqlTypeConstant.INT)
    private Integer sort;

    @TableField(exist = false)
    private JSONObject message;

}